package task1;

import java.util.Iterator;
import java.util.List;

public class StudentDel {
    public static void delete(List<Student> students, String id){
        Iterator iterator = students.iterator();
        while(iterator.hasNext()){
            Student student = (Student)iterator.next();
            if (student.getId().equals(id)) {
                iterator.remove();
                System.out.println("已删除学生：" + student);
                return;
            }
        }
        System.out.println("未找到该ID学生，删除失败");
    }
}
